package com.cqeec.demo.web.controller;

import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cqeec.demo.bean.AdminRole;
import com.cqeec.demo.service.AdminRoleService;

/**
 * 系统角色控制器类
 * 
 * @Title: AdminRoleController
 * @Descripton: 接收系统角色信息并调用业务逻辑进行处理，然后返回信息给视图层
 */
@Controller
@RequestMapping("/system/role")
public class AdminRoleController {
	// 菜单
	@Resource(name = "adminRoleService")
	private AdminRoleService adminRoleService;
	
	@RequestMapping("/roleListByPage")
	@ResponseBody
	public Map<String, Object> getRoleListByPage(HttpServletRequest request,@RequestParam("role_name") String rolename,
			@RequestParam("page") Integer page,@RequestParam("rows") Integer pagesize) {
		return adminRoleService.getRoleListByPage(rolename, page, pagesize);
	}
	
	@RequestMapping("/doSave")
	@ResponseBody
	public Map<String, Object> saveEntity(HttpServletRequest request,AdminRole adminRole) {
		return adminRoleService.saveEntity(adminRole);
	}
	
	@RequestMapping("/doUpdate")
	@ResponseBody
	public Map<String, Object> updateEntity(HttpServletRequest request,AdminRole adminRole) {
		return adminRoleService.updateEntity(adminRole);
	}
	
	@RequestMapping("/doDisAuth")
	@ResponseBody
	public Map<String, Object> doDisAuth(HttpServletRequest request,AdminRole adminRole) {
		return adminRoleService.doDisAuth(adminRole);
	}
}
